<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
<<<<<<< HEAD
//动态注册
use think\Route;
////动态注册
//Route::get('home','index/index/index');
//Route::post('post','index/index/post');
//
////get 和 post 方式都可以
//Route::rule('rule','index/index/index');
////大部分路由都支持的请求方式
//Route::any('any','index/index/index');


//动态路由,路由参数
//Route::get('user/:id','index/index/user');
//可选参数
//Route::get('user/[:id]','index/index/user');
Route::get('user/[:id]$','index/index/user');

//闭包
Route::get('user/[:id]',function($id){
    return 'ID为:'.$id;
});

//路由参数
Route::get('userlist','admin/user/index',['ext'=>'html|sb']);

//变量规则
//安装指定的规则屈匹配变量,越容易匹配越往后放
Route::get('blog/:year/:month','index/blog/article',['year'=>'\d{4}','month'=>'\d{2}']);

Route::get('blog/:id','index/blog/index',['method'=>'get'],['id'=>'\d+']);
//Route::get('blog/:id','index/blog/index');
Route::get('blog/:name','index/blog/read',['method'=>'get'],['name'=>'\w+']);

//路由分组
Route::group('blog',[
   ':year/:month'=>[
     'index/blog/article',
       ['method'=>'get'],
       ['year'=>'\d{4}'],
       ['month'=>'\d{2}']
   ],
    ':id'=>[
      'index/blog/index',
=======

use think\Route;
//路由规则
Route::get('home','index/index/index');

Route::post('ppp','index/index/ppp');
//rule 包含post get
Route::rule('xx','index/index/ppp');
//any 所有tp5可以使用的访问方法
Route::any('oo','index/index/ppp');

//动态路由 路由参数
//无参 只有默认参数
//Route::get('user','index/index/user');
//传递参数 必传
//Route::get('user/:id','index/index/user');
//传递参数 可选参数[]
//Route::get('user/[:id]','index/index/user');
//传递参数 匹配参数
Route::get('user/[:id]$','index/index/user');

//闭包定义 不通过控制器
Route::get('user/:id',function($id){
    return 'id是：'.$id;
});

//路由参数
Route::get('userlist','admin/user/index',['ext'=>'html|shtml']);


//变量规则
//按照指定的规则去分配变量 越容易匹配的分规则越要往后放
//year month
/*Route::get('blog/:year/:month','index/blog/article',['method'=>'get'],['year'=>'\d{4}','month'=>'\d{2}']);

//访问id
Route::get('blog/:id','index/blog/index',['method'=>'get'],['id'=>'\d+']);
//访问name
Route::get('blog/:name','index/blog/read',['method'=>'get'],['name'=>'\w+']);*/

//路由分组
Route::group('blog',[
    ':year/:month'=>[
        'index/blog/article',
        ['method'=>'get'],
        ['year'=>'\d{4}','month'=>'\d{2}']
    ],
    ':id'=>[
        'index/blog/index',
>>>>>>> div
        ['method'=>'get'],
        ['id'=>'\d+']
    ],
    ':name'=>[
        'index/blog/read',
        ['method'=>'get'],
        ['name'=>'\w+']
    ]
]);

<<<<<<< HEAD

//路由生成
Route::get('url','index/index/url');
//静态注册


//静态资源路由
Route::resource('man','admin/Man');
return [
//    '__pattern__' => [
//        'name' => '\w+',
//    ],
//    '[hello]'     => [
//        ':id'   => ['index/hello', ['method' => 'get'], ['id' => '\d+']],
//        ':name' => ['index/hello', ['method' => 'post']],
//    ],

];
=======
//生成url 请详见/url  url类
Route::get('url','index/index/url');

//跳转的路由
Route::get('jump','admin/index/jump');

//重定向
Route::get('rd','admin/index/rd');

//生成资源控制器的路由
Route::resource('users','rest/user');
Route::get('users/read/:id','rest/user/readpage');


/*return [
    '__pattern__' => [
        'name' => '\w+',
    ],
    '[hello]'     => [
        ':id'   => ['index/hello', ['method' => 'get'], ['id' => '\d+']],
        ':name' => ['index/hello', ['method' => 'post']],
    ],

];*/
>>>>>>> div
